package myJs.implicits

import japgolly.scalajs.react.callback.AsyncCallback
import myJs.Implicits._
import myJs.myPkg.reactHookForm._

import scala.scalajs.js

trait MyUseFormRTTool {

  implicit class MyUseFormRT(v: UseFormRT) {

    def myHandleSubmit[A](onValid: js.Dictionary[js.Any] => AsyncCallback[A]) = {
      val useValid: js.Function1[js.Dictionary[js.Any], js.Any] = (data: js.Dictionary[js.Any]) =>
        onValid(data).runNow()
      v.handleSubmit(useValid)
    }

  }

}
